<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<PF:basePath/>">
<title>用户专业数据管理</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<jsp:include page="/view/conf/include.jsp"></jsp:include>
</head>
<body class="easyui-layout">

	<div data-options="region:'west',split:true,border:false"
		style="width: 200px;">
		<div class="TREE_COMMON_BOX_SPLIT_DIV">
			<a id="classTypeTreeReload" href="javascript:void(0)"
				class="easyui-linkbutton" data-options="plain:true"
				iconCls="icon-reload">刷新</a> <a id="classTypeTreeOpenAll"
				href="javascript:void(0)" class="easyui-linkbutton"
				data-options="plain:true" iconCls="icon-sitemap">展开</a>
		</div>
		<ul id="orgTree"></ul>
	</div>
	<div class="easyui-layout" data-options="region:'center',border:false">

		<div data-options="region:'north',border:false">
			<form id="searchUsermajorForm">
				<table class="editTable">
					<tr>
						<td class="title">组织机构:</td>
						<td><input id="ORGNAME_RULE" type="text" readonly="readonly"
							style="background: #F3F3E8"> <input id="ORGID_RULE"
							name="ORGID:=" type="hidden"></td>
						<td class="title">用户名称:</td>
						<td><input name="B.NAME:like" type="text"></td>
						<td class="title">专业名称:</td>
						<td><input name="E.TITLE:like" type="text"></td>
						<td colspan="1"><a id="a_search" href="javascript:void(0)"
							class="easyui-linkbutton" iconCls="icon-search">查询</a> <a
							id="a_reset" href="javascript:void(0)" class="easyui-linkbutton"
							iconCls="icon-reload">清除条件</a></td>
					</tr>
					<tr>
						<td class="title">岗位名称:</td>
						<td><input name="POST:like" type="text"></td>
						<td colspan="5"></td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataUsermajorGrid">
				<thead>
					<tr>
						<th data-options="field:'ck',checkbox:true"></th>
						<th field="USERNAME" data-options="sortable:true" width="30">用户名称</th>
						<th field="LOGINNAME" data-options="sortable:true" width="30">登录名称</th>
						<th field="ORGNAME" data-options="sortable:true" width="30">机构名称</th>
						<th field="MAJORTITLE" data-options="sortable:true" width="40">专业</th>
						<th field="PSTATE" data-options="sortable:true" width="40">状态</th>
						<!--<th field="ETIME" data-options="sortable:true" width="40">结束时间</th>-->
						<th field="STIME" data-options="sortable:true" width="40">开始时间</th>
						<!-- <th field="LTIME" data-options="sortable:true" width="40">最近学习时间</th> -->
						<th field="ANUM" data-options="sortable:true" width="40">全部课程</th>
						<!--<th field="NNUM" data-options="sortable:true" width="40">未学课程</th> -->
						<!--<th field="SNUM" data-options="sortable:true" width="40">学中课程</th> -->
						<th field="CNUM" data-options="sortable:true" width="40">已完成课程</th>
						<th field="SNUM" data-options="sortable:true" width="40">学习中课程</th>
						<th field="PROCESS" data-options="sortable:true" width="40">学习进度</th>
						<!--<th field="USETIME" data-options="sortable:true" width="40">学习时长</th> -->
					</tr>
				</thead>
			</table>
			<form method="post" action="usermajor/exportExcel.do" id="reportForm">
				<input type="hidden" name="ruleText" id="ruleTextId" />
			</form>
		</div>
	</div>
</body>
<script type="text/javascript">
	var url_delActionUsermajor = "usermajor/del.do";//删除URL
	var url_formActionUsermajor = "usermajor/form.do";//增加、修改、查看URL
	var url_searchActionUsermajor = "usermajor/query.do";//查询URL
	var title_windowUsermajor = "用户专业管理";//功能名称
	var gridUsermajor;//数据表格对象
	var searchUsermajor;//条件查询组件对象
	var toolBarUsermajor = [ {
		id : 'listExport',
		text : '导出',
		iconCls : 'icon-excel',
		handler : listExport
	}, {
		id : 'listExport',
		text : '加载专业学习记录',
		iconCls : 'icon-move_to_folder',
		handler : addDataUsermajor
	}, {
		id : 'del',
		text : '删除',
		iconCls : 'icon-remove',
		handler : delDataUsermajor
	} ];
	$(function() {
		//初始化数据表格
		gridUsermajor = $('#dataUsermajorGrid').datagrid({
			url : url_searchActionUsermajor,
			fit : true,
			fitColumns : true,
			'toolbar' : toolBarUsermajor,
			pagination : true,
			closable : true,
			checkOnSelect : true,
			border : false,
			striped : true,
			rownumbers : true,
			ctrlSelect : true
		});
		//初始化条件查询
		searchUsermajor = $('#searchUsermajorForm').searchForm({
			gridObj : gridUsermajor
		});

		$('#orgTree').tree({
			url : 'organization/organizationTree.do',
			onSelect : function(node) {
				$('#ORGID_RULE').val(node.id);
				$('#ORGNAME_RULE').val(node.text);
				searchUsermajor.dosearch({
					'ruleText' : searchUsermajor.arrayStr()
				});
			}
		});
	});
	//导出
	function listExport() {
		$.messager.alert('报表加载中...', '请等待,不要关闭本窗口直至报表导出完成... ...', 'warning');
		$('#ruleTextId').val(searchUsermajor.arrayStr());
		$('#reportForm').submit();
	}

	//手动加载专业学习记录
	function addDataUsermajor() {
		var url = url_formActionUsermajor + '?operateType=' + PAGETYPE.ADD;
		$.farm.openWindow({
			id : 'winUsermajor',
			width : 600,
			height : 300,
			modal : true,
			url : url,
			title : '手动加载专业学习记录'
		});
	}

	//删除
	function delDataUsermajor() {
		var selectedArray = $(gridUsermajor).datagrid('getSelections');
		if (selectedArray.length > 0) {
			// 有数据执行操作
			var str = selectedArray.length + MESSAGE_PLAT.SUCCESS_DEL_NEXT_IS;
			$.messager.confirm(MESSAGE_PLAT.PROMPT, str, function(flag) {
				if (flag) {
					$(gridUsermajor).datagrid('loading');
					$.post(url_delActionUsermajor + '?ids='
							+ $.farm.getCheckedIds(gridUsermajor, 'ID'), {},
							function(flag) {
								var jsonObject = JSON.parse(flag, null);
								$(gridUsermajor).datagrid('loaded');
								if (jsonObject.STATE == 0) {
									$(gridUsermajor).datagrid('reload');
								} else {
									var str = MESSAGE_PLAT.ERROR_SUBMIT
											+ jsonObject.MESSAGE;
									$.messager.alert(MESSAGE_PLAT.ERROR, str,
											'error');
								}
							});
				}
			});
		} else {
			$.messager.alert(MESSAGE_PLAT.PROMPT, MESSAGE_PLAT.CHOOSE_ONE,
					'info');
		}
	}
</script>
</html>